Crate bevy_audio

source ·
Expand description

Audio support for the game engine Bevy

fn main() {
   App::new()
        .add_plugins((MinimalPlugins, AssetPlugin::default(), AudioPlugin::default()))
        .add_systems(Startup, play_background_audio)
        .run();
}

fn play_background_audio(asset_server: Res<AssetServer>, mut commands: Commands) {
    commands.spawn(AudioBundle {
        source: asset_server.load("background_audio.ogg"),
        settings: PlaybackSettings::LOOP,
    });
}

Modules§

Structs§

Enums§

Traits§

  • A trait that allows adding a custom audio source to the object. This is implemented for App to allow registering custom Decodable types.
  • Common interactions with an audio sink.
  • A trait for working generically across different Sample format types.
  • A type implementing this trait can be converted to a rodio::Source type. It must be Send and Sync in order to be registered. Types that implement this trait usually contain raw sound data that can be converted into an iterator of samples. This trait is implemented for AudioSource. Check the example decodable for how to implement this trait on a custom type.
  • Represents a value of a single sample.
  • A source of samples.

Type Aliases§